\hypertarget{a00067}{}\section{E\+:/knet-\/git/knet/knet/hash.c 文件参考}
\label{a00067}\index{E\+:/knet-\/git/knet/knet/hash.\+c@{E\+:/knet-\/git/knet/knet/hash.\+c}}
{\ttfamily \#include \char`\"{}hash.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}list.\+h\char`\"{}}\\*
\subsection*{结构体}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{a00015}{\+\_\+hash\+\_\+t}
\item 
struct \hyperlink{a00016}{\+\_\+hash\+\_\+value\+\_\+t}
\end{DoxyCompactItemize}
\subsection*{函数}
\begin{DoxyCompactItemize}
\item 
\hyperlink{a00056_aa13ac88a5567525fe44f3670134c3d96_aa13ac88a5567525fe44f3670134c3d96}{khash\+\_\+value\+\_\+t} $\ast$ \hyperlink{a00067_aa5ef4de9803e44078b9bda01aab51065_aa5ef4de9803e44078b9bda01aab51065}{hash\+\_\+value\+\_\+create} (uint32\+\_\+t key, const char $\ast$string\+\_\+key, void $\ast$value)
\begin{DoxyCompactList}\small\item\em 创建值 \end{DoxyCompactList}\item 
void \hyperlink{a00067_a802913eb2b0816f5c3c9d26a991f861d_a802913eb2b0816f5c3c9d26a991f861d}{hash\+\_\+value\+\_\+destroy} (\hyperlink{a00056_aa13ac88a5567525fe44f3670134c3d96_aa13ac88a5567525fe44f3670134c3d96}{khash\+\_\+value\+\_\+t} $\ast$hash\+\_\+value)
\begin{DoxyCompactList}\small\item\em 销毁值 \end{DoxyCompactList}\item 
int \hyperlink{a00067_a0ec14665ff21b19523785b967f48ec10_a0ec14665ff21b19523785b967f48ec10}{hash\+\_\+value\+\_\+equal} (\hyperlink{a00056_aa13ac88a5567525fe44f3670134c3d96_aa13ac88a5567525fe44f3670134c3d96}{khash\+\_\+value\+\_\+t} $\ast$hash\+\_\+value, uint32\+\_\+t key)
\begin{DoxyCompactList}\small\item\em 测试数字键是否相等 \end{DoxyCompactList}\item 
int \hyperlink{a00067_a75b92bdd0e76be083813e5e01ce47aa4_a75b92bdd0e76be083813e5e01ce47aa4}{hash\+\_\+value\+\_\+equal\+\_\+string\+\_\+key} (\hyperlink{a00056_aa13ac88a5567525fe44f3670134c3d96_aa13ac88a5567525fe44f3670134c3d96}{khash\+\_\+value\+\_\+t} $\ast$hash\+\_\+value, const char $\ast$key)
\begin{DoxyCompactList}\small\item\em 测试字符串键是否相等 \end{DoxyCompactList}\item 
uint32\+\_\+t \hyperlink{a00067_abf1a155690ff024f3e8a82878ac4b887_abf1a155690ff024f3e8a82878ac4b887}{\+\_\+hash\+\_\+string} (const char $\ast$key)
\begin{DoxyCompactList}\small\item\em 计算字符串整数键值 \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{a00067_aab909a28870f824900d55d4158ecf807_aab909a28870f824900d55d4158ecf807}{hash\+\_\+value\+\_\+get\+\_\+value} (\hyperlink{a00056_aa13ac88a5567525fe44f3670134c3d96_aa13ac88a5567525fe44f3670134c3d96}{khash\+\_\+value\+\_\+t} $\ast$hash\+\_\+value)
\begin{DoxyCompactList}\small\item\em 内部使用，哈希表，同时支持数字或字符串作为key \end{DoxyCompactList}\item 
uint32\+\_\+t \hyperlink{a00067_ae2eae4207ed7825a923eb744b1b03be0_ae2eae4207ed7825a923eb744b1b03be0}{hash\+\_\+value\+\_\+get\+\_\+key} (\hyperlink{a00056_aa13ac88a5567525fe44f3670134c3d96_aa13ac88a5567525fe44f3670134c3d96}{khash\+\_\+value\+\_\+t} $\ast$hash\+\_\+value)
\begin{DoxyCompactList}\small\item\em 取得数字键 \end{DoxyCompactList}\item 
const char $\ast$ \hyperlink{a00067_ae64de86e8fdc8f5e278cebe0f9856c09_ae64de86e8fdc8f5e278cebe0f9856c09}{hash\+\_\+value\+\_\+get\+\_\+string\+\_\+key} (\hyperlink{a00056_aa13ac88a5567525fe44f3670134c3d96_aa13ac88a5567525fe44f3670134c3d96}{khash\+\_\+value\+\_\+t} $\ast$hash\+\_\+value)
\begin{DoxyCompactList}\small\item\em 取得字符串键 \end{DoxyCompactList}\item 
\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$ \hyperlink{a00067_aa4a5b9547c52b16f292c317a41f69d24_aa4a5b9547c52b16f292c317a41f69d24}{hash\+\_\+create} (uint32\+\_\+t size, \hyperlink{a00056_af806592520383146be2f3aac316beb45_af806592520383146be2f3aac316beb45}{knet\+\_\+hash\+\_\+dtor\+\_\+t} dtor)
\begin{DoxyCompactList}\small\item\em 建立哈希表 \end{DoxyCompactList}\item 
void \hyperlink{a00067_a7c2257af49b4f207001c43e43514a226_a7c2257af49b4f207001c43e43514a226}{hash\+\_\+destroy} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash)
\begin{DoxyCompactList}\small\item\em 销毁哈希表 \end{DoxyCompactList}\item 
int \hyperlink{a00067_aff2221d277f95457bc2fdf4215bd196e_aff2221d277f95457bc2fdf4215bd196e}{hash\+\_\+add} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, uint32\+\_\+t key, void $\ast$value)
\begin{DoxyCompactList}\small\item\em 添加元素 \end{DoxyCompactList}\item 
int \hyperlink{a00067_a9fd87e76680bcfb665a95535746c166d_a9fd87e76680bcfb665a95535746c166d}{hash\+\_\+add\+\_\+string\+\_\+key} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, const char $\ast$key, void $\ast$value)
\begin{DoxyCompactList}\small\item\em 添加元素 \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{a00067_a544058a99adc9150c308b0bf4a98cf07_a544058a99adc9150c308b0bf4a98cf07}{hash\+\_\+remove} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, uint32\+\_\+t key)
\begin{DoxyCompactList}\small\item\em 移除元素 \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{a00067_a319fdee63a99809c36438ea7200b0785_a319fdee63a99809c36438ea7200b0785}{hash\+\_\+remove\+\_\+string\+\_\+key} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, const char $\ast$key)
\begin{DoxyCompactList}\small\item\em 移除元素 \end{DoxyCompactList}\item 
int \hyperlink{a00067_ad8391c6d9c70f03fde25994da030b0c5_ad8391c6d9c70f03fde25994da030b0c5}{hash\+\_\+delete} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, uint32\+\_\+t key)
\begin{DoxyCompactList}\small\item\em 销毁元素 \end{DoxyCompactList}\item 
int \hyperlink{a00067_aa82d295b5298fc0f2e46d583ee83731b_aa82d295b5298fc0f2e46d583ee83731b}{hash\+\_\+replace} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, uint32\+\_\+t key, void $\ast$value)
\begin{DoxyCompactList}\small\item\em 替换 \end{DoxyCompactList}\item 
int \hyperlink{a00067_a042aba69d8451fd5322e3fe28aa65306_a042aba69d8451fd5322e3fe28aa65306}{hash\+\_\+replace\+\_\+string\+\_\+key} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, const char $\ast$key, void $\ast$value)
\begin{DoxyCompactList}\small\item\em 替换 \end{DoxyCompactList}\item 
int \hyperlink{a00067_a74d116a714c4a2078f3163d7943ad41e_a74d116a714c4a2078f3163d7943ad41e}{hash\+\_\+delete\+\_\+string\+\_\+key} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, const char $\ast$key)
\begin{DoxyCompactList}\small\item\em 销毁元素 \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{a00067_a0cb115747d9533d24341fd2620c3ffb9_a0cb115747d9533d24341fd2620c3ffb9}{hash\+\_\+get} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, uint32\+\_\+t key)
\begin{DoxyCompactList}\small\item\em 获取元素 \end{DoxyCompactList}\item 
void $\ast$ \hyperlink{a00067_afdbec876fbce40dd8750d26bb7f59e5b_afdbec876fbce40dd8750d26bb7f59e5b}{hash\+\_\+get\+\_\+string\+\_\+key} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash, const char $\ast$key)
\begin{DoxyCompactList}\small\item\em 获取元素 \end{DoxyCompactList}\item 
uint32\+\_\+t \hyperlink{a00067_a5cd157b8d91524da9b9f4a07f9d07f39_a5cd157b8d91524da9b9f4a07f9d07f39}{hash\+\_\+get\+\_\+size} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash)
\begin{DoxyCompactList}\small\item\em 取得元素数量 \end{DoxyCompactList}\item 
\hyperlink{a00056_aa13ac88a5567525fe44f3670134c3d96_aa13ac88a5567525fe44f3670134c3d96}{khash\+\_\+value\+\_\+t} $\ast$ \hyperlink{a00067_ab9b8488e9e0eef3735144721f5adc625_ab9b8488e9e0eef3735144721f5adc625}{hash\+\_\+get\+\_\+first} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash)
\begin{DoxyCompactList}\small\item\em 重置遍历器，取第一个元素 \end{DoxyCompactList}\item 
\hyperlink{a00056_aa13ac88a5567525fe44f3670134c3d96_aa13ac88a5567525fe44f3670134c3d96}{khash\+\_\+value\+\_\+t} $\ast$ \hyperlink{a00067_a00daf47a1da21760919550dd144e1f2c_a00daf47a1da21760919550dd144e1f2c}{hash\+\_\+next} (\hyperlink{a00056_aa242a9a673d8677076543d5768798f2c_aa242a9a673d8677076543d5768798f2c}{khash\+\_\+t} $\ast$hash)
\begin{DoxyCompactList}\small\item\em 哈希表遍历器的下一个元素 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{函数说明}
\hypertarget{a00067_abf1a155690ff024f3e8a82878ac4b887_abf1a155690ff024f3e8a82878ac4b887}{}\index{hash.\+c@{hash.\+c}!\+\_\+hash\+\_\+string@{\+\_\+hash\+\_\+string}}
\index{\+\_\+hash\+\_\+string@{\+\_\+hash\+\_\+string}!hash.\+c@{hash.\+c}}
\subsubsection[{\+\_\+hash\+\_\+string}]{\setlength{\rightskip}{0pt plus 5cm}uint32\+\_\+t \+\_\+hash\+\_\+string (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{key}
\end{DoxyParamCaption}
)}\label{a00067_abf1a155690ff024f3e8a82878ac4b887_abf1a155690ff024f3e8a82878ac4b887}


计算字符串整数键值 


\begin{DoxyParams}{参数}
{\em key} & 字符串 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
整数键值 
\end{DoxyReturn}
\hypertarget{a00067_aff2221d277f95457bc2fdf4215bd196e_aff2221d277f95457bc2fdf4215bd196e}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+add@{hash\+\_\+add}}
\index{hash\+\_\+add@{hash\+\_\+add}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+add}]{\setlength{\rightskip}{0pt plus 5cm}int hash\+\_\+add (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{uint32\+\_\+t}]{key, }
\item[{void $\ast$}]{value}
\end{DoxyParamCaption}
)}\label{a00067_aff2221d277f95457bc2fdf4215bd196e_aff2221d277f95457bc2fdf4215bd196e}


添加元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 键 \\
\hline
{\em value} & 值 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_a9fd87e76680bcfb665a95535746c166d_a9fd87e76680bcfb665a95535746c166d}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+add\+\_\+string\+\_\+key@{hash\+\_\+add\+\_\+string\+\_\+key}}
\index{hash\+\_\+add\+\_\+string\+\_\+key@{hash\+\_\+add\+\_\+string\+\_\+key}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+add\+\_\+string\+\_\+key}]{\setlength{\rightskip}{0pt plus 5cm}int hash\+\_\+add\+\_\+string\+\_\+key (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{const char $\ast$}]{key, }
\item[{void $\ast$}]{value}
\end{DoxyParamCaption}
)}\label{a00067_a9fd87e76680bcfb665a95535746c166d_a9fd87e76680bcfb665a95535746c166d}


添加元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 字符串键 \\
\hline
{\em value} & 值 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_aa4a5b9547c52b16f292c317a41f69d24_aa4a5b9547c52b16f292c317a41f69d24}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+create@{hash\+\_\+create}}
\index{hash\+\_\+create@{hash\+\_\+create}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+create}]{\setlength{\rightskip}{0pt plus 5cm}{\bf khash\+\_\+t}$\ast$ hash\+\_\+create (
\begin{DoxyParamCaption}
\item[{uint32\+\_\+t}]{size, }
\item[{{\bf knet\+\_\+hash\+\_\+dtor\+\_\+t}}]{dtor}
\end{DoxyParamCaption}
)}\label{a00067_aa4a5b9547c52b16f292c317a41f69d24_aa4a5b9547c52b16f292c317a41f69d24}


建立哈希表 


\begin{DoxyParams}{参数}
{\em size} & 哈希表桶数量, 0将使用默认桶数量 \\
\hline
{\em dtor} & 用户自定义值销毁函数 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
khash\+\_\+t实例 
\end{DoxyReturn}
\hypertarget{a00067_ad8391c6d9c70f03fde25994da030b0c5_ad8391c6d9c70f03fde25994da030b0c5}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+delete@{hash\+\_\+delete}}
\index{hash\+\_\+delete@{hash\+\_\+delete}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+delete}]{\setlength{\rightskip}{0pt plus 5cm}int hash\+\_\+delete (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{uint32\+\_\+t}]{key}
\end{DoxyParamCaption}
)}\label{a00067_ad8391c6d9c70f03fde25994da030b0c5_ad8391c6d9c70f03fde25994da030b0c5}


销毁元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 键 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_a74d116a714c4a2078f3163d7943ad41e_a74d116a714c4a2078f3163d7943ad41e}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+delete\+\_\+string\+\_\+key@{hash\+\_\+delete\+\_\+string\+\_\+key}}
\index{hash\+\_\+delete\+\_\+string\+\_\+key@{hash\+\_\+delete\+\_\+string\+\_\+key}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+delete\+\_\+string\+\_\+key}]{\setlength{\rightskip}{0pt plus 5cm}int hash\+\_\+delete\+\_\+string\+\_\+key (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{const char $\ast$}]{key}
\end{DoxyParamCaption}
)}\label{a00067_a74d116a714c4a2078f3163d7943ad41e_a74d116a714c4a2078f3163d7943ad41e}


销毁元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 字符串键 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_a7c2257af49b4f207001c43e43514a226_a7c2257af49b4f207001c43e43514a226}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+destroy@{hash\+\_\+destroy}}
\index{hash\+\_\+destroy@{hash\+\_\+destroy}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+destroy}]{\setlength{\rightskip}{0pt plus 5cm}void hash\+\_\+destroy (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash}
\end{DoxyParamCaption}
)}\label{a00067_a7c2257af49b4f207001c43e43514a226_a7c2257af49b4f207001c43e43514a226}


销毁哈希表 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
\end{DoxyParams}
\hypertarget{a00067_a0cb115747d9533d24341fd2620c3ffb9_a0cb115747d9533d24341fd2620c3ffb9}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+get@{hash\+\_\+get}}
\index{hash\+\_\+get@{hash\+\_\+get}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+get}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ hash\+\_\+get (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{uint32\+\_\+t}]{key}
\end{DoxyParamCaption}
)}\label{a00067_a0cb115747d9533d24341fd2620c3ffb9_a0cb115747d9533d24341fd2620c3ffb9}


获取元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 键 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em 0} & 未找到 \\
\hline
{\em 有效指针} & \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_ab9b8488e9e0eef3735144721f5adc625_ab9b8488e9e0eef3735144721f5adc625}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+get\+\_\+first@{hash\+\_\+get\+\_\+first}}
\index{hash\+\_\+get\+\_\+first@{hash\+\_\+get\+\_\+first}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+get\+\_\+first}]{\setlength{\rightskip}{0pt plus 5cm}{\bf khash\+\_\+value\+\_\+t}$\ast$ hash\+\_\+get\+\_\+first (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash}
\end{DoxyParamCaption}
)}\label{a00067_ab9b8488e9e0eef3735144721f5adc625_ab9b8488e9e0eef3735144721f5adc625}


重置遍历器，取第一个元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em 0} & 没有元素 \\
\hline
{\em khash\+\_\+value\+\_\+t实例} & \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_a5cd157b8d91524da9b9f4a07f9d07f39_a5cd157b8d91524da9b9f4a07f9d07f39}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+get\+\_\+size@{hash\+\_\+get\+\_\+size}}
\index{hash\+\_\+get\+\_\+size@{hash\+\_\+get\+\_\+size}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+get\+\_\+size}]{\setlength{\rightskip}{0pt plus 5cm}uint32\+\_\+t hash\+\_\+get\+\_\+size (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash}
\end{DoxyParamCaption}
)}\label{a00067_a5cd157b8d91524da9b9f4a07f9d07f39_a5cd157b8d91524da9b9f4a07f9d07f39}


取得元素数量 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
元素数量 
\end{DoxyReturn}
\hypertarget{a00067_afdbec876fbce40dd8750d26bb7f59e5b_afdbec876fbce40dd8750d26bb7f59e5b}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+get\+\_\+string\+\_\+key@{hash\+\_\+get\+\_\+string\+\_\+key}}
\index{hash\+\_\+get\+\_\+string\+\_\+key@{hash\+\_\+get\+\_\+string\+\_\+key}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+get\+\_\+string\+\_\+key}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ hash\+\_\+get\+\_\+string\+\_\+key (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{const char $\ast$}]{key}
\end{DoxyParamCaption}
)}\label{a00067_afdbec876fbce40dd8750d26bb7f59e5b_afdbec876fbce40dd8750d26bb7f59e5b}


获取元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 字符串键 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em 0} & 未找到 \\
\hline
{\em 有效指针} & \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_a00daf47a1da21760919550dd144e1f2c_a00daf47a1da21760919550dd144e1f2c}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+next@{hash\+\_\+next}}
\index{hash\+\_\+next@{hash\+\_\+next}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+next}]{\setlength{\rightskip}{0pt plus 5cm}{\bf khash\+\_\+value\+\_\+t}$\ast$ hash\+\_\+next (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash}
\end{DoxyParamCaption}
)}\label{a00067_a00daf47a1da21760919550dd144e1f2c_a00daf47a1da21760919550dd144e1f2c}


哈希表遍历器的下一个元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em 0} & 没有元素 \\
\hline
{\em khash\+\_\+value\+\_\+t实例} & \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_a544058a99adc9150c308b0bf4a98cf07_a544058a99adc9150c308b0bf4a98cf07}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+remove@{hash\+\_\+remove}}
\index{hash\+\_\+remove@{hash\+\_\+remove}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+remove}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ hash\+\_\+remove (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{uint32\+\_\+t}]{key}
\end{DoxyParamCaption}
)}\label{a00067_a544058a99adc9150c308b0bf4a98cf07_a544058a99adc9150c308b0bf4a98cf07}


移除元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 键 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em 0} & 未找到 \\
\hline
{\em 有效指针} & 值 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_a319fdee63a99809c36438ea7200b0785_a319fdee63a99809c36438ea7200b0785}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+remove\+\_\+string\+\_\+key@{hash\+\_\+remove\+\_\+string\+\_\+key}}
\index{hash\+\_\+remove\+\_\+string\+\_\+key@{hash\+\_\+remove\+\_\+string\+\_\+key}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+remove\+\_\+string\+\_\+key}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ hash\+\_\+remove\+\_\+string\+\_\+key (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{const char $\ast$}]{key}
\end{DoxyParamCaption}
)}\label{a00067_a319fdee63a99809c36438ea7200b0785_a319fdee63a99809c36438ea7200b0785}


移除元素 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 字符串键 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em 0} & 未找到 \\
\hline
{\em 有效指针} & 值 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_aa82d295b5298fc0f2e46d583ee83731b_aa82d295b5298fc0f2e46d583ee83731b}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+replace@{hash\+\_\+replace}}
\index{hash\+\_\+replace@{hash\+\_\+replace}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+replace}]{\setlength{\rightskip}{0pt plus 5cm}int hash\+\_\+replace (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{uint32\+\_\+t}]{key, }
\item[{void $\ast$}]{value}
\end{DoxyParamCaption}
)}\label{a00067_aa82d295b5298fc0f2e46d583ee83731b_aa82d295b5298fc0f2e46d583ee83731b}


替换 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 键 \\
\hline
{\em value} & 值 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_a042aba69d8451fd5322e3fe28aa65306_a042aba69d8451fd5322e3fe28aa65306}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+replace\+\_\+string\+\_\+key@{hash\+\_\+replace\+\_\+string\+\_\+key}}
\index{hash\+\_\+replace\+\_\+string\+\_\+key@{hash\+\_\+replace\+\_\+string\+\_\+key}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+replace\+\_\+string\+\_\+key}]{\setlength{\rightskip}{0pt plus 5cm}int hash\+\_\+replace\+\_\+string\+\_\+key (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+t} $\ast$}]{hash, }
\item[{const char $\ast$}]{key, }
\item[{void $\ast$}]{value}
\end{DoxyParamCaption}
)}\label{a00067_a042aba69d8451fd5322e3fe28aa65306_a042aba69d8451fd5322e3fe28aa65306}


替换 


\begin{DoxyParams}{参数}
{\em hash} & khash\+\_\+t实例 \\
\hline
{\em key} & 字符串键 \\
\hline
{\em value} & 值 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_aa5ef4de9803e44078b9bda01aab51065_aa5ef4de9803e44078b9bda01aab51065}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+value\+\_\+create@{hash\+\_\+value\+\_\+create}}
\index{hash\+\_\+value\+\_\+create@{hash\+\_\+value\+\_\+create}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+value\+\_\+create}]{\setlength{\rightskip}{0pt plus 5cm}{\bf khash\+\_\+value\+\_\+t} $\ast$ hash\+\_\+value\+\_\+create (
\begin{DoxyParamCaption}
\item[{uint32\+\_\+t}]{key, }
\item[{const char $\ast$}]{string\+\_\+key, }
\item[{void $\ast$}]{value}
\end{DoxyParamCaption}
)}\label{a00067_aa5ef4de9803e44078b9bda01aab51065_aa5ef4de9803e44078b9bda01aab51065}


创建值 


\begin{DoxyParams}{参数}
{\em key} & 数字键 \\
\hline
{\em string\+\_\+key} & 字符串键 \\
\hline
{\em value} & 值 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
khash\+\_\+value\+\_\+t实例 
\end{DoxyReturn}
\hypertarget{a00067_a802913eb2b0816f5c3c9d26a991f861d_a802913eb2b0816f5c3c9d26a991f861d}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+value\+\_\+destroy@{hash\+\_\+value\+\_\+destroy}}
\index{hash\+\_\+value\+\_\+destroy@{hash\+\_\+value\+\_\+destroy}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+value\+\_\+destroy}]{\setlength{\rightskip}{0pt plus 5cm}void hash\+\_\+value\+\_\+destroy (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+value\+\_\+t} $\ast$}]{hash\+\_\+value}
\end{DoxyParamCaption}
)}\label{a00067_a802913eb2b0816f5c3c9d26a991f861d_a802913eb2b0816f5c3c9d26a991f861d}


销毁值 


\begin{DoxyParams}{参数}
{\em hash\+\_\+value} & khash\+\_\+value\+\_\+t实例 \\
\hline
\end{DoxyParams}
\hypertarget{a00067_a0ec14665ff21b19523785b967f48ec10_a0ec14665ff21b19523785b967f48ec10}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+value\+\_\+equal@{hash\+\_\+value\+\_\+equal}}
\index{hash\+\_\+value\+\_\+equal@{hash\+\_\+value\+\_\+equal}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+value\+\_\+equal}]{\setlength{\rightskip}{0pt plus 5cm}int hash\+\_\+value\+\_\+equal (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+value\+\_\+t} $\ast$}]{hash\+\_\+value, }
\item[{uint32\+\_\+t}]{key}
\end{DoxyParamCaption}
)}\label{a00067_a0ec14665ff21b19523785b967f48ec10_a0ec14665ff21b19523785b967f48ec10}


测试数字键是否相等 


\begin{DoxyParams}{参数}
{\em hash\+\_\+value} & khash\+\_\+value\+\_\+t实例 \\
\hline
{\em key} & 整数键 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em 0} & 不相等 \\
\hline
{\em 非零} & 相等 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_a75b92bdd0e76be083813e5e01ce47aa4_a75b92bdd0e76be083813e5e01ce47aa4}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+value\+\_\+equal\+\_\+string\+\_\+key@{hash\+\_\+value\+\_\+equal\+\_\+string\+\_\+key}}
\index{hash\+\_\+value\+\_\+equal\+\_\+string\+\_\+key@{hash\+\_\+value\+\_\+equal\+\_\+string\+\_\+key}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+value\+\_\+equal\+\_\+string\+\_\+key}]{\setlength{\rightskip}{0pt plus 5cm}int hash\+\_\+value\+\_\+equal\+\_\+string\+\_\+key (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+value\+\_\+t} $\ast$}]{hash\+\_\+value, }
\item[{const char $\ast$}]{key}
\end{DoxyParamCaption}
)}\label{a00067_a75b92bdd0e76be083813e5e01ce47aa4_a75b92bdd0e76be083813e5e01ce47aa4}


测试字符串键是否相等 


\begin{DoxyParams}{参数}
{\em hash\+\_\+value} & khash\+\_\+value\+\_\+t实例 \\
\hline
{\em key} & 字符串键 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em 0} & 不相等 \\
\hline
{\em 非零} & 相等 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00067_ae2eae4207ed7825a923eb744b1b03be0_ae2eae4207ed7825a923eb744b1b03be0}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+value\+\_\+get\+\_\+key@{hash\+\_\+value\+\_\+get\+\_\+key}}
\index{hash\+\_\+value\+\_\+get\+\_\+key@{hash\+\_\+value\+\_\+get\+\_\+key}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+value\+\_\+get\+\_\+key}]{\setlength{\rightskip}{0pt plus 5cm}uint32\+\_\+t hash\+\_\+value\+\_\+get\+\_\+key (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+value\+\_\+t} $\ast$}]{hash\+\_\+value}
\end{DoxyParamCaption}
)}\label{a00067_ae2eae4207ed7825a923eb744b1b03be0_ae2eae4207ed7825a923eb744b1b03be0}


取得数字键 


\begin{DoxyParams}{参数}
{\em hash\+\_\+value} & khash\+\_\+value\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
数字键 
\end{DoxyReturn}
\hypertarget{a00067_ae64de86e8fdc8f5e278cebe0f9856c09_ae64de86e8fdc8f5e278cebe0f9856c09}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+value\+\_\+get\+\_\+string\+\_\+key@{hash\+\_\+value\+\_\+get\+\_\+string\+\_\+key}}
\index{hash\+\_\+value\+\_\+get\+\_\+string\+\_\+key@{hash\+\_\+value\+\_\+get\+\_\+string\+\_\+key}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+value\+\_\+get\+\_\+string\+\_\+key}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ hash\+\_\+value\+\_\+get\+\_\+string\+\_\+key (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+value\+\_\+t} $\ast$}]{hash\+\_\+value}
\end{DoxyParamCaption}
)}\label{a00067_ae64de86e8fdc8f5e278cebe0f9856c09_ae64de86e8fdc8f5e278cebe0f9856c09}


取得字符串键 


\begin{DoxyParams}{参数}
{\em hash\+\_\+value} & khash\+\_\+value\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
字符串键 
\end{DoxyReturn}
\hypertarget{a00067_aab909a28870f824900d55d4158ecf807_aab909a28870f824900d55d4158ecf807}{}\index{hash.\+c@{hash.\+c}!hash\+\_\+value\+\_\+get\+\_\+value@{hash\+\_\+value\+\_\+get\+\_\+value}}
\index{hash\+\_\+value\+\_\+get\+\_\+value@{hash\+\_\+value\+\_\+get\+\_\+value}!hash.\+c@{hash.\+c}}
\subsubsection[{hash\+\_\+value\+\_\+get\+\_\+value}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ hash\+\_\+value\+\_\+get\+\_\+value (
\begin{DoxyParamCaption}
\item[{{\bf khash\+\_\+value\+\_\+t} $\ast$}]{hash\+\_\+value}
\end{DoxyParamCaption}
)}\label{a00067_aab909a28870f824900d55d4158ecf807_aab909a28870f824900d55d4158ecf807}


内部使用，哈希表，同时支持数字或字符串作为key 

取得自定义值 
\begin{DoxyParams}{参数}
{\em hash\+\_\+value} & khash\+\_\+value\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
自定义值 
\end{DoxyReturn}
